<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			var arr = [1,2,3,4,5,6,7,8];
			for(var i = 0;i<arr.length/2;i++){
				//arr[0]    arr[arr.length-1-0];
				//arr[1]    arr[arr.length-1-1];
				//arr[2]    arr[arr.length-1-2];
				//arr[3]    arr[arr.length-1-3];	
				//借助第三方变量交换两个变量的值
				var temp = arr[i];
				arr[i] = arr[arr.length-1-i];
				arr[arr.length-1-i] = temp;
			}
			console.log(arr);
		</script>
	</body>
</html>
